<?php
namespace app\course\validate\record;

use think\Validate;

/**
 * 卡券验证
 */
class LearnRecord extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'course_id'      => 'require|integer',
        'section_id'     => 'require|integer',
        'current_time'   => 'require|integer',
        'course_type'    => 'require|in:1,2,3,4',
        'learn_status'   => 'require|in:all,not_started,learning,finished'
    ];

    protected $field = [
        'course_id'     => '课程',
        'section_id'    => '课时',
        'current_time'  => '进度',
        'course_type'   => '课程类型',
        'learn_status'  => '学习状态',

    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'       => ['course_id', 'section_id', 'current_time'],
        'course'    => ['course_type'],//, 'learn_status'
    ];

}
